package cn.wolfcode.qo;

import cn.hutool.core.date.DateUtil;
import cn.wolfcode.domain.Business;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Getter
@Setter
@ToString
public class BusinessReportQueryObject extends QueryObject{
    private String groupType = "b.name";//分组类型,必须有一个默认值,否则无法分组
    private Long businessId;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date startDate;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endDate;
    private Integer consumptionStatus;
    private Boolean ano;

    public Date getEndDate(){
        //使用Hutool工具类,设置时分秒为23:59:59
        if(endDate == null){
            return null;
        }
        return DateUtil.endOfDay(endDate);
    }
}
